package com.starview.star.compiler.cafe.compile;

import com.starview.star.compiler.cafe.compile.cont.IContinuation;



public class Exit
{
  private final String label;
  private final Exit parent;
  private final IContinuation cont;

  public Exit(String label, IContinuation cont, Exit parent)
  {
    this.label = label;
    this.cont = cont;
    this.parent = parent;
  }

  public String getLabel()
  {
    return label;
  }

  public Exit getParent()
  {
    return parent;
  }

  public IContinuation getCont()
  {
    return cont;
  }

  public Exit find(String label)
  {
    if (this.label.equals(label))
      return this;
    else if (parent != null)
      return parent.find(label);
    else
      return null;
  }
}
